package com.fuluwa.interfaces.pay.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fuluwa.application.pay.biz.PayBackBiz;
import com.fuluwa.infra.web.AbstractDomainController;
import com.fuluwa.infra.web.Result;
import com.fuluwa.interfaces.pay.web.vo.TenpayBackVo;

@RequestMapping(value = "/tenpay")
public class TenpayBackController extends AbstractDomainController {

	@Autowired
	@Qualifier("tenpayBackBiz")
	private PayBackBiz tenpayBackBiz;

	@RequestMapping(value = "/callback")
	@ResponseBody
	public Result callback(@RequestBody TenpayBackVo backVo) {

		tenpayBackBiz.callback(backVo);

		// TODO Add bizInfo to resp

		return getSuccessResult(); // 成功：success; 失败：fail
	}

	@RequestMapping(value = "/notify")
	@ResponseBody
	public String notify(@RequestBody TenpayBackVo backVo) {

		tenpayBackBiz.notify(backVo);

		return "success"; // 成功：success; 失败：fail
	}

}